$(function() {
    if (typeof(Storage) !== "undefined")
    {
        $('.wd-loading').show();
  
        $.post(localStorage.domain_app+"/webservice/guest/index.php", {
            page: 1,
            user_id: localStorage.userID
        }, function(res) {
            
            $('.wd-list-guest').html(res.html);
            $('#page').val(res.page);
            $('#continue_first_char').val(res.continue_first_char);
            $('#keyword').val(res.keyword);
            $('#end_paging').val(res.end_paging);
            $('.wd-loading').hide();
            if(res.hide_icon_email==1){
                $("#btn_send_mail").hide();
            }else{
                $("#btn_send_mail").show();
            }
            editGuest();
            deleteGuest();
            searchGuest();

        }, "json");
        
        var btn_send_mail = false;
        $("#btn_send_mail").click(function() {
             $('.wd-loading').show();
            if (btn_send_mail == false) {

                btn_send_mail = true;
                $.post(localStorage.domain_app+"/webservice/guest/send_email_guest_list_info.php", {
                    user_id: localStorage.userID
                }, function(res) {
                    btn_send_mail = false;
                    print_alert(res.msg);
                     $('.wd-loading').hide();
                }, "json");
            }

        });
    }
});